//
//  HLUserOptionRequest.m
//  YueYue
//
//  Created by hulu001 on 2023/5/17.
//

#import "HLUserOptionRequest.h"

@implementation HLUserOptionRequest
{
    NSDictionary *_params;
    HLUserOptionType _type;
}

- (id)initWithType:(HLUserOptionType)type params:(NSDictionary *)params
{
    self = [super init];
    
    if (self) {
        _type = type;
        _params = params;
    }
    
    return self;
}



- (NSString *)requestUrl
{
    switch (_type) {
        case HLUserOptionTypeFollow:
            return @"/relationship/follow";
            break;
        case HLUserOptionTypeUnFollow:
            return @"/relationship/follow";
            break;
        case HLUserOptionTypeBlack:
            return @"/relationship/update_blacklist";
            break;
        case HLUserOptionTypeUnBlack:
            return @"/relationship/update_blacklist";
            break;
        case HLUserOptionTypeChatUp:
            return @"/user/chat_up";
            break;
        case HLUserOptionTypePassword: // no
            return @"/login/bindOrModify/pwd";
            break;
        case HLUserOptionTypeUpdateAvatar: // no
            return @"/auth/modify_avatar";
            break;
        case HLUserOptionTypeLogout:
            return @"/logff";
            break;
        case HLUserOptionTypeLogoutVerify:
            return @"/validSmsCode";
            break;
        case HLUserOptionTypeBind:// no
            return @"/bind/third";
            break;
        case HLUserOptionTypeTrans:
            return @"/app/tran/text";
            break;
        case HLUserOptionTypeFeedback:
            return @"/feedback/save/new";
            break;
        case HLUserOptionTypeVideoLike:
            return @"/short/video/thumbup";
            break;
        case HLUserOptionTypeVideoUnLike:
            return @"/short/video/thumbup/cancel";
            break;
        case HLUserOptionTypeLoveBell:
            return @"/new/video/match/popup";
            break;
        case HLUserOptionTypeUpdate:
            return @"/app/app_update";
            break;
        case HLUserOptionTypeRelationship:
            return [NSString stringWithFormat:@"/relationship/social_relations/%@", _params[@"othersId"]];
            break;
    }
    
}

- (YTKRequestMethod)requestMethod
{
    if (_type == HLUserOptionTypeBlack || _type == HLUserOptionTypeUnBlack){
        return YTKRequestMethodPUT;
    } else if (_type == HLUserOptionTypeVideoLike || _type == HLUserOptionTypeLoveBell || _type == HLUserOptionTypeVideoUnLike || _type == HLUserOptionTypeRelationship|| _type == HLUserOptionTypeUpdate) {
        return YTKRequestMethodGET;
    }
    return YTKRequestMethodPOST;
}

- (id)requestArgument
{
    if (_params){
        return _params;
    } else {
        return @{};
    }
}


@end
